package student.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.json.JSONException;
import org.json.JSONObject;

import student.dao.ScheduleDAO;

import student.dto.ScheduleDTO;

public class ScheduleService {
	
	private ScheduleDAO sdao;
		
	public void setScheduleDAO(ScheduleDAO sdao){
		this.sdao = sdao;		
	}
	
	public void modifyScheduleSservice(ScheduleDTO sdto){
		sdao.modifyScheduleDAO(sdto);
	}
	
	public ScheduleDTO getScheduleByNoService(String no) {
		return sdao.getScheduleByNoDAO(no);
	}
	
	public void deleteScheduleByNoService(String no){
		sdao.deleteScheduleByNoDAO(no);
	}
	
	public void insertScheduleService(ScheduleDTO sdto){
		System.out.println("333 : "+sdto.getTreatementYear());
		sdao.insertScheduleDAO(sdto);
	}
	
	public List getAllScheduleServiceByList() throws Exception {
		
		return sdao.getAllScheduleDAOByList();
	}
	
	public String getAllScheduleService(HashMap map) throws JSONException{
		
		List list = sdao.getAllSchedule(map);
		JSONObject jobj = new JSONObject();
		
		jobj.put("SCHEDULE_LIST", list);
		System.out.println(jobj.toString());
		return jobj.toString();
	}
	
	

}
